diff options
| author | Fuwn <[email protected]> | 2026-01-24 13:09:50 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-01-24 13:09:50 +0000 |
| commit | 396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b (patch) | |
| tree | b9df4ca6a70db45cfffbae6fdd7252e20fb8e93c /src/app/(main)/teams/[teamId]/TeamManage.tsx | |
| download | umami-main.tar.xz umami-main.zip | |
Created from https://vercel.com/new
Diffstat (limited to 'src/app/(main)/teams/[teamId]/TeamManage.tsx')
| -rw-r--r-- | src/app/(main)/teams/[teamId]/TeamManage.tsx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/app/(main)/teams/[teamId]/TeamManage.tsx b/src/app/(main)/teams/[teamId]/TeamManage.tsx new file mode 100644 index 0000000..88cbad9 --- /dev/null +++ b/src/app/(main)/teams/[teamId]/TeamManage.tsx @@ -0,0 +1,32 @@ +import { Button, Dialog, DialogTrigger, Modal } from '@umami/react-zen'; +import { useRouter } from 'next/navigation'; +import { ActionForm } from '@/components/common/ActionForm'; +import { useMessages, useModified } from '@/components/hooks'; +import { TeamDeleteForm } from './TeamDeleteForm'; + +export function TeamManage({ teamId }: { teamId: string }) { + const { formatMessage, labels, messages } = useMessages(); + const router = useRouter(); + const { touch } = useModified(); + + const handleLeave = async () => { + touch('teams'); + router.push('/settings/teams'); + }; + + return ( + <ActionForm + label={formatMessage(labels.deleteTeam)} + description={formatMessage(messages.deleteTeamWarning)} + > + <DialogTrigger> + <Button variant="danger">{formatMessage(labels.delete)}</Button> + <Modal> + <Dialog title={formatMessage(labels.deleteTeam)} style={{ width: 400 }}> + {({ close }) => <TeamDeleteForm teamId={teamId} onSave={handleLeave} onClose={close} />} + </Dialog> + </Modal> + </DialogTrigger> + </ActionForm> + ); +} |